 
package DataBase;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Vector;

public class RemoveCommentAboutOverHrs {
	
	
	
	private Vector<String> workHours;

	public RemoveCommentAboutOverHrs(Vector<String> empHours)
	{
		this.workHours=empHours;
	}
	
	
	public void saveComment()
	{	
	 
		
		SQLConnection sc=new SQLConnection();
		try {
			
				 	
			PreparedStatement ps2 = sc.getConnection().prepareStatement("UPDATE employee_working_hours set comments=? WHERE Eid=? and date=? and clock_in=?");     // and clock_in=? and clock_out=?");      //("INSERT INTO employee_working_hours set comments=? WHERE Eid=? and date=? and clock_out=?;");  
			
			sc.getConnection().setAutoCommit(false);
			ps2.setString(1,"");                            //   A CHE TAM S UTF-8 ?  [solved]
			ps2.setString(2,(String) workHours.get(0));
			ps2.setString(3,(String) workHours.get(1));
			ps2.setString(4,(String) workHours.get(2));   
 
			ps2.executeUpdate();
			sc.getConnection().commit();
			ps2.close();
			 
			sc.getConnection().close(); 
		}
		catch (SQLException e) {
			// TODO Auto-generated catch block
			
			e.printStackTrace();
			
			
		}

}
	
}
